/**
 * Created by syt on 2017/8/25.
 */
$(function(){
    init_business_info();
    $(document).on('click', '#biz-improve-btn', improve_info);

});

function getGeocoder(lnglatXY){
    var map = new AMap.Map('mapContainer', {
        resizeEnable: true,
        zoom: 15,
        center: lnglatXY
    });
}

function init_business_info(){
    var url = server + "/server/business/businessRest/current.json";
    $.get(url, function(json){
        if(20000 === json.code){
            $("#username").val(json.data.username);
            $("#businessName").val(json.data.businessName);
            $("#businessPhone").val(json.data.businessPhone);
            $("#address").val(json.data.address);
            $("#industryCategory").val(json.data.industryCategory);
            $("#employeeNumber").val(json.data.employeeNumber);
            var x = parseFloat(json.data.lonAndlat.split(",")[0]);
            var y = parseFloat(json.data.lonAndlat.split(",")[1]);
            var lnglatXY = [x, y]; //已知点坐标
            getGeocoder(lnglatXY);
        }

    });
}

function improve_info(){
    var url = server + "/server/business/register/improveInfo.json";
    var form = $("#improve-info-form").serialize();
    $.post(url, form, function(json){
        if(20000 === json.code){

        }
    });
}